package com.buddy.hadoop.hdfs;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileStatus;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;

import java.io.IOException;

/**
 * 查看HDFS文件的最后修改时间
 */
public class GetLTime {

    public static void main(String[] args) throws IOException {
        Configuration conf = new Configuration();
        FileSystem hdfs = FileSystem.get(conf);
        Path fpath = new Path(args[0]);
        FileStatus fileStatus = hdfs.getFileStatus(fpath);
        long modificationTile = fileStatus.getModificationTime();
        System.out.println("Modification time is:"+modificationTile);
    }
}
